package com.kichina.parking.module.feign.deal;

import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONObject;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author Surging
 * @version 1.0
 * @ClassName CarBanRemoteCall
 * @date 2022-08-24 20:16
 * @desc 车禁 服务远程调用
 */
@Slf4j
@Component
public class CarBanRemoteCall {

    /**
     * App云请求地址
     */
    @Value("${remote.app.url}")
    private String appUrl;

    /**
     * @param object 同步数据实体
     *{
     *     "deviceTarget": "901000001",
     *     "deviceProperty": {
     *         "card_number": "1111,1111,1111,1111,1111"
     *
     *     }
     * }
     * @author Surging
     * @Description 车禁服务离线/在线远程更新
     * @Return java.lang.String
     * @date 20:21 2022-08-24
     **/
    public String cardBanRemotePost(Object object) {
        String route = "/sh/parking/property";
        String returnInfo = HttpRequest.post(appUrl + route)
                .body(JSONObject.toJSONString(object))
                .execute()
                .body();
        return returnInfo;
    }

}
